Developing Microsoft® Media Foundation Applications by Anton Polinger

Developing Microsoft® Media Foundation Applications by Anton Polinger

Author:Anton Polinger [Anton Polinger]
Language: eng
Format: epub
Tags: COMPUTERS / Interactive & Multimedia
ISBN: 9780735656574
Publisher: Microsoft Press
Published: 2011-10-17T16:00:00+00:00


Chapter 7. Media Foundation Sinks

The Sample AVI File Sink

The AVI Media Sink

The AVI Media Stream

Media sinks are objects in the Microsoft Media Foundation (MF) pipeline that receive one or more input streams but have no output streams. The purpose of most sinks in the MF pipeline is to consume all of the data and provide it to the user in some form. In an MF topology, each requested (selected) stream comes out of a media source, is processed by zero or more MFTs, and ends in the media sink.

There are three major types of media sinks: renderer, archive, and streaming sinks. A renderer sink “renders” the input data and presents it to the user. The way that a renderer sink presents the information to the user depends on the type of data. For example, the Enhanced Video Renderer (EVR) renders input video frames to the screen, whereas the Streaming Audio Renderer (SAR) sends the audio samples to an output audio device. Archive sinks save data into a media file, usually after multiplexing several data streams into one. Unlike rendering sinks, archive sinks pull data from the source as fast as it can be delivered. Finally, streaming sinks are designed for streaming network scenarios and transmit the data over the network. In some ways, streaming sinks are similar to the archive sinks—they also pull data from the source as quickly as they can. However, unlike archive sinks, streaming sinks support rate changes and seeking.

Because MF uses the pull data flow model, sinks are responsible for requesting data from the source components. To request samples, a sink fires sample request events, which are received by the sink’s client. The client then requests samples from the component upstream from the sink, which in turn pulls data from its upstream component, and so on.

Unlike sources, sinks do not have dedicated creator objects. There is no equivalent to the IMFByteStreamHandler object that is supposed to create a sink. Unfortunately, MF does not have a discovery system capable of automatically finding which sinks are available on the machine. There are no designated registry locations that contain available sinks and their corresponding container types.

Instead, all MF sinks are treated as pure COM objects. To instantiate a custom sink, your application needs to know its COM Class ID (CLSID) and either explicitly call CoCreateInstance() or pass that CLSID to a manually created activator object. If you want to instantiate one of the standard Microsoft-provided sinks, you can use one of the built-in MF sink creation functions, but these functions use hard-coded lists of internal sink objects. The functions do not dynamically discover supported sinks on the machine by looking in the registry for lists of sink CLSIDs but instantiate specific and well-known sink objects. Here is a list of MF sink creation functions provided in Windows 7:

MFCreate3GPMediaSink() Create a media sink capable of writing files and streams in 3GP format.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.